import Vue from 'vue'
import Router from 'vue-router'

/* Layout */
import Layout from '../views/layout/Layout'
// in development-env not use lazy-loading, because lazy-loading too many pages will cause webpack hot update too slow. so only in production use lazy-loading;
// detail: https://panjiachen.github.io/vue-element-admin-site/#/lazy-loading

Vue.use(Router)


/**
 * hidden: true                   if `hidden:true` will not show in the sidebar(default is false)
 * alwaysShow: true               if set true, will always show the root menu, whatever its child routes length
 *                                if not set alwaysShow, only more than one route under the children
 *                                it will becomes nested mode, otherwise not show the root menu
 * redirect: noredirect           if `redirect:noredirect` will no redirct in the breadcrumb
 * name:'router-name'             the name is used by <keep-alive> (must set!!!)
 * meta : {
    title: 'title'               the name show in submenu and breadcrumb (recommend set)
    icon: 'svg-name'             the icon show in the sidebar,
  }
 **/

export const constantRouterMap = [
  {path: '/login', component: () => import('../views/login/index'), hidden: true},
  {path: '/404', component: () => import('@/views/404'), hidden: true},

  {
    path: '/',
    component: Layout,
    redirect: '/dashboard',
    name: 'Dashboard',
    hidden: true,
    children: [{
      path: 'dashboard',
      component: () => import('@/views/dashboard/index')
    }]
  }, {
    path: '/data',
    component: Layout,
    redirect: '/dashboard',
    name: 'data',
    meta: {title: '账号管理', icon: 'setting'},
    children: [
      {
        path: 'menbercenter',
        name: 'menbercenter',
        isRefreshUserInfo: true,
        component: () => import('@/views/PersonalCenter/index'),
        meta: {title: '个人管理', icon: 'setting',}
      },
      {
        path: 'agent',
        name: 'agent',
        component: () => import('@/views/AgentMag/index'),
        meta: {title: '子代管理', icon: 'setting', agency_type: 1}
      }, {
        path: 'ChatSettings',
        name: 'ChatSettings',
        component: () => import('@/views/ChatSettings/index'),
        meta: {title: '聊天设置', icon: 'setting', agency_type: 2}
      },
      {
        path: 'blacklist',
        name: 'blacklist',
        component: () => import('@/views/BlackList/index'),
        meta: {title: '黑名单管理', icon: 'setting', agency_type: 2}
      },
    ]
  }, {
    path: '/operation',
    component: Layout,
    redirect: '/operation/menbercenter',
    name: 'operation',
    meta: {title: '代理运营', icon: 'process'},
    children: [{
      path: 'Receipt',
      name: 'Receipt',
      component: () => import('@/views/Receipt/index'),
      meta: {title: '收款账号管理', icon: 'setting',}
    }, {
      path: 'my_recharge',
      name: 'my_recharge',
      component: () => import('@/views/agencyRecharge/index'),
      meta: {title: '个人充值管理', icon: 'setting',}
    }, {
      path: 'rechargeChild',
      name: 'rechargeChild',
      component: () => import('@/views/agencyChildRecharge/index'),
      meta: {title: '子代充值管理', icon: 'setting', agency_type: 1}
    }, {
      path: 'orders',
      name: 'orders',
      component: () => import('@/views/Order/index'),
      meta: {title: '用户充值管理', icon: 'setting',}
    }
    ]
  },{
    path: '/useroperation',
    component: Layout,
    redirect: '/useroperation/evaluation',
    name: 'useroperation',
    meta: {title: '用户运营', icon: 'process', agency_type: 1},
    children: [
      {
        path: 'chatrecord',
        name: 'chatrecord',
        component: () => import('@/views/ChatRecord/index'),
        meta: {title: '聊天管理', icon: 'setting', agency_type: 1}
      },{
      path: 'blacklist',
      name: 'blacklist',
      component: () => import('@/views/BlackList/index'),
      meta: { title: '黑名单管理', icon: 'setting', agency_type: 1 }
    },
    {
      path: 'evaluation',
      name: 'evaluation',
      component: () => import('@/views/Evaluation/index'),
      meta: {title: '评价管理', icon: 'setting', agency_type: 1}
    },
    {
      path: 'complaint',
      name: 'complaint',
      component: () => import('@/views/Complaint/index'),
      meta: {title: '投诉管理', icon: 'setting', agency_type: 1}
    },
    ]
  },
  {
    path: '/report',
    component: Layout,
    redirect: '/report/report',
    name: 'report',
    meta: {title: '报表统计', icon: 'setting'},
    children: [{
      path: 'report',
      name: 'report',
      component: () => import('@/views/report/index'),
      meta: {title: '报表管理', icon: 'setting',}
    }, {
      path: '',
      name: '',
      component: () => import('@/views/report/index'),
      meta: {title: '标签', icon: 'setting',}
    }
    ]
  },

  {path: '*', redirect: '/404', hidden: true}
]

export default new Router({
  scrollBehavior: () => ({y: 0}),
  routes: constantRouterMap
})

